package top.rufous.hrm.util.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import top.rufous.hrm.util.AjaxResult;

@RestControllerAdvice
public class HrmGLobalExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
    public AjaxResult runtimeHandler(RuntimeException e){
        return AjaxResult.me().setSuccess(false).setMessage("嗨嗨!"+e.getMessage()+"异常来啦!");
    }

}
